<?php
$linkPreview = Yii::app()->params['preview']['product_shop'];

$this->widget('ext.mylib.widgets.Gridview.DGridView', array(
    'id'           => 'data-grid',
    'dataProvider' => $model->search(),
    'htmlOptions' => array('class' => 'hastable'),
    'columnGroup' => array(50, 0, 150, 150, 100, 100, 65, 65, 100, 108),
    'columns' => array(
        array(
            'class'       => 'ext.mylib.widgets.Gridview.DIdColumn',
            'htmlOptions' => array('style' => 'text-align: center;'),
        ),
        'title',
        'code',
        array(
            'name'   => 'type_id',
            'header' => $model->getAttributeLabel('type_id'),
            'value'  => 'DNewsletterType::model()->getTypeText($data->type_id)',
        ),
        array(
            'name'   => 'price',
            'header' => $model->getAttributeLabel('price'),
            'value'  => 'Yii::app()->format->formatDollar($data->price)',
            'htmlOptions' => array(
                'style' => 'text-align: right;'
            ),
        ),
        array(
            'name'   => 'promotional_price',
            'header' => $model->getAttributeLabel('promotional_price'),
            'value'  => '(! empty($data->promotional_price)) ? Yii::app()->format->formatDollar($data->promotional_price) : ""',
            'htmlOptions' => array(
                'style' => 'text-align: right;'
            ),
        ),
        array(
            'class' => 'ext.mylib.widgets.ActiveColumn.DActiveColumn',
            'name'  => 'hot',
            'url'   => Yii::app()->createUrl('dadmin/productShop/toggleHot/id'),
            'cssClass' => 'toggleHot',
        ),
        array(
            'class' => 'ext.mylib.widgets.ActiveColumn.DActiveColumn',
            'name'  => 'activated_flag',
            'url'   => Yii::app()->createUrl('dadmin/productShop/toggleActive/id'),
        ),
        array(
            'class'       => 'ext.mylib.widgets.OrderColumn.OrderColumn',
            'header'      => $model->getAttributeLabel('sort_order'),
            'modelClass'  => 'DProductShop',
            'htmlOptions' => array('style' => 'text-align:center'),
        ),
        array(
            'class'       => 'ext.mylib.widgets.Gridview.DButtonColumn',
            'afterDelete' => 'function(){ 
                showMessage("#message", "' . Yii::t('DadminModule.msg', 'deleted') . '"); 
            }',
            'previewButtonUrl' => 'Yii::app()->createUrl("'.$linkPreview.'", 
                array("page"=>$data->id . "-" . "pvw"))
            ',
        ),
    ),
));
?>
<div class="clearfix"></div>